<?php

function get_system_categories() {
    $CI = &get_instance();
    $CI->load->database();
    $CI->db->get('ots_ticket_cat')->result_array();
}
function get_category_name($id_category){
    $CI = &get_instance();
    $CI->load->model('categories/admin_m');
    if(is_object($cat=$CI->admin_m->get_cat_details($id_category,true))){
        return $cat->category;
    }
    return __('admin_root_cat');//'Root category';
}
function generate_category_depth($id_cat){
    $CI = &get_instance();
    $CI->load->model('categories/admin_m');
    if(is_object($cat=$CI->admin_m->get_cat_details($id_cat,true))){
    //if(is_object($cat = $CI->db->get_where('ots_ticket_cat',array('id'=>$id_cat))->row())){
        return $cat->depth+1;
    }
    return 0;
}
